package cn.fastoo.common.dao.product;
import cn.fastoo.common.entity.product.Product;
import cn.fastoo.common.entity.product.ProductAttrValue;
import cn.fastoo.common.entity.product.ProductSku;
import cn.fastoo.common.sampleframe.dao.FastDao;
import cn.fastoo.common.sampleframe.dao.impl.FastDaoImpl;
import cn.fastoo.common.sampleframe.search.Search;
import cn.fastoo.common.sampleframe.springside.Collections3;
import cn.fastoo.common.utils.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.sql.DataSource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;


@Component
@Transactional
public class ProductDao extends FastDaoImpl<Product> implements FastDao<Product> {


    @Autowired
    @Qualifier("mainDS")
    private void setJt(DataSource ds){
        this.jt = new JdbcTemplate(ds);
    }

    public Logger logger = LoggerFactory.getLogger(ProductDao.class);

    @Override
    public void insert(Product product) {
        product.setCreateTime(new Date());
        super.insert(product);
    }
}
